<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <meta http-equiv="Pragma" content="no-cache"> 
    <meta http-equiv="Cache-Control" content="no-cache"> 
    <meta http-equiv="Expires" content="0"> 
    <meta name="description" content="">
    <meta name="author" content="">
    <title>{:lang('ADMIN_CENTER')}</title>
    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->
    <!-- <link href="__TMPL__/public/assets/themes/{:cmf_get_admin_style()}/bootstrap.min.css" rel="stylesheet"> -->
    <link href="__STATIC__/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="__TMPL__/public/assets/themes/{:cmf_get_admin_style()}/login.css" type="text/css" rel="stylesheet"> 
    <script>
        if (window.parent !== window.self) {
            document.write              = '';
            window.parent.location.href = window.self.location.href;
            setTimeout(function () {
                document.body.innerHTML = '';
            }, 0);
        }
    </script>
</head> 
<body> 
    <div class="login">
        <div class="message">网站后台管理系统 V3.0</div>
        <div id="darkbannerwrap"></div>
        
          <form action="" method="post" id="mainForm" onsubmit="return false;">
            <input name="action" value="login" type="hidden">
            <input type="text" id="input_username" class="required" name="username"
                   placeholder="{:lang('USERNAME_OR_EMAIL')}" title="{:lang('USERNAME_OR_EMAIL')}"
                   value="{:cookie('admin_username')}">
            <hr class="hr15">
            <input type="password" id="input_password" class="required" name="password"
                   placeholder="{:lang('PASSWORD')}" title="{:lang('PASSWORD')}">
            <hr class="hr15">
            <input type="text" name="captcha" placeholder="验证码" class="captcha required" style="width: 60%;">
            <em class="em1" style="float: right;font-size:0;">
                <captcha height="50" width="120" font-size="18"/>
            </em>
            <label id="captcha-error" class="error" for="captcha" style="display: block;"></label>
            <hr class="hr15">
            <input class="a1" style="width:100%;" type="submit" value="{:lang('LOGIN')}">
            <!-- <hr class="hr15"> -->
            <!-- 帮助 <a onClick="alert('请联系管理员')">忘记密码</a> -->
            <label id="log-error" class="error"></label>
        </form>
    </div>

    <div class="copyright"><a href="http://www.vchengnet.com/" target="_blank">惟诚科技</a> 版权所有 Copyright © 2016-<script>document.write(new Date().getFullYear());</script></div>

</body>
<script type="text/javascript">
    //全局变量
    var GV = {
        ROOT: "__ROOT__/",
        WEB_ROOT: "__WEB_ROOT__/",
        JS_ROOT: "static/js/",
        APP: ''/*当前应用名*/
    };
</script>
<script src="__TMPL__/public/assets/js/jquery-1.10.2.min.js"></script>
<script src="__STATIC__/js/wind.js"></script>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/jquery.validate/jquery.validate.min.js"></script>
<script>
    (function () {
        document.getElementById('input_username').focus();

        $("#mainForm").validate({
            messages: {
                username: {
                    required: "* 请输入用户名"
                },
                password: {
                    required: "* 请输入密码"
                },
                captcha: {
                    required: "* 请输入验证码"
                }
            },
            submitHandler: function () {
                $.ajax({
                    type: "POST",
                    url: "{:url('public/doLogin')}",
                    contentType: "application/x-www-form-urlencoded; charset=utf-8",
                    data: $("#mainForm").serialize(),
                    dataType: 'json',
                    beforeSend: function () {
                        $(".login .a1").addClass("disabled").attr("disabled", true).val("正在登录...");
                    },
                    success: function (result) {

                        if (result) {
                            if (result.code == 1) {
                                location.href = result.url;
                            } else {
                                $(".login .a1").removeClass("disabled").removeAttr("disabled").val("立即登录");
                                // 显示提示信息
                                $("#log-error").html("* "+result.msg).show();
                                // 刷新验证码
                                $(".verify_img").attr("src", $(".verify_img").attr("src") + "&refresh=" + Math.random());
                                // 清空验证码输入框
                                $(".captcha").val('');
                            }
                        }
                    }
                });
            }
        })
    })();
</script>
</html>
